/*
 * Copyright 2010-2012 Susanta Tewari. <freecode4susant@users.sourceforge.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package genomemap.cef.command;

import cef.command.Command;
import cef.command.CommandException;
import genomemap.cef.event.RepeatsTests_Evt;
import genomemap.test.RepeatsTransitionTests;

/**
 * @author Susanta Tewari
 * @since Sep 26, 2011
 */
public class RepeatsTests_Cmd extends Command<RepeatsTests_Evt> {

    /** independence test */
    private RepeatsTransitionTests.IndependenceTest ind_test;

    /** homogeneity test */
    private RepeatsTransitionTests.HomogeneityTest homo_test;

    public RepeatsTests_Cmd(final RepeatsTests_Evt event) {
        super(event);
    }

    @Override
    public void executeImpl() throws CommandException {

        final RepeatsTransitionTests tests =
            new RepeatsTransitionTests(getEvent().getOrganismData());

        ind_test  = tests.new IndependenceTest();
        homo_test = tests.new HomogeneityTest();
    }

    /**
     * @return test of independence
     */
    public RepeatsTransitionTests.IndependenceTest getIndependenceTest() {
        return ind_test;
    }

    /**
     * @return p-value for test of homogeneity
     */
    public RepeatsTransitionTests.HomogeneityTest getHomogeneityTest() {
        return homo_test;
    }
}
